package com.tanhua.admin.module.dynamicmanage.controller;

import cn.hutool.core.util.ObjectUtil;
import com.tanhua.admin.module.dynamicmanage.service.impl.ManagerVideoServiceImpl;
import com.tanhua.admin.module.dynamicmanage.vo.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("manage")
@Slf4j
public class ManagerVideoController {

    @Autowired
    private ManagerVideoServiceImpl managerVideoService;

    @GetMapping("videos")
    public ResponseEntity<PageResult> queryVideos(@RequestParam Map<String,Object> param){

        try {
            PageResult pageResult = this.managerVideoService.queryVideos(param);
            if (ObjectUtil.isNotEmpty(pageResult)) {
                return ResponseEntity.ok(pageResult);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
    }
}
